<?php
namespace app\index\controller;

use think\Controller;
use think\Session;

class Zpaydel extends Controller{
    //一元支付
    public function index(){
        $time = date('Y-m-d H:i:s');
        $time = strtotime($time);
        $zpay=db('zpay')->select();
        foreach ($zpay as $value){
            if($value['flg']=='未付款'){
                if((($time-strtotime($value['createtime']))/3600)>1) {
                    $rs = db('zpay')->where('id', $value['id'])->delete();
                    if ($rs) {
                        echo '成功';
                    } else {
                        echo '失败';
                    }
                }
            }
        }
    }
}